﻿Imports SACommon

Public Class frmFileOpen
    Public Property FileName As String
    Private Sub frmFileOpen_Load(sender As Object, e As EventArgs) Handles Me.Load
        lblServer.Text = ""
        lblDirectory.Text = ""
        lblVersionFile.Text = ""
    End Sub

#Region "Process UI"
    Private Sub btnLoadDef_Click(sender As Object, e As EventArgs) Handles btnLoadDef.Click
        Dim openFileDialog1 As New OpenFileDialog() With {.InitialDirectory = "c:\",
                                                          .Filter = "txt files (*.udf)|*.udf",
                                                          .FilterIndex = 2,
                                                          .RestoreDirectory = True}

        If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            txtAppDef.Text = openFileDialog1.FileName
            Dim tResult = UpdateCore.ReadAppDefinitionFile(openFileDialog1.FileName)
            If tResult.Result = SAEventArgs.Results.Success Then
                lblServer.Text = UpdateCore.RepositoryServer
                lblDirectory.Text = UpdateCore.RepositoryFolder
                lblVersionFile.Text = UpdateCore.VersionFile
            Else
                lblServer.Text = ""
                lblDirectory.Text = ""
                lblVersionFile.Text = ""
            End If
        End If
    End Sub
    Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
        FileName = txtAppDef.Text
        Me.Close()
    End Sub
    Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
        FileName = ""
        Me.Close()
    End Sub
#End Region
End Class